//@author A0101878B

#ifndef FileHandler_H
#define FileHandler_H


#include <fstream>
#include "StatusMessages.h"
#include "Log.h"

static const string _LOGNAME = "ToDoItter_Do_Not_Delete.txt";
static const int TASKLINES = 5;

class FileHandler{
private:
	/**
	* Purpose:
	* Checks if the file Log is empty
	*@return True - File Log is empty, False - File Log not empty
	*/
	bool emptyFile();
	void readLines(ifstream& input, vector<string>& data);
	void writeLines(ofstream& output, vector<string>& data);
public:
	/**
	* Purpose:
	* Checks if file Log exists
	* If it exists, reads and load the tasks from file Log into vector<string> data
	* @param data - vector to be loaded with tasks from Log
	*@return Success in loading file; File Log does not exist; File Log is empty
	*/
	int load(vector<string>& data); 
	/**
	* Purpose:
	* Checks if file Log exist
	* If it exists, writes the task from vector<string> data into file Log
	* If it does not exist, create a file Log
	* @param data - vector containing all the tasks to be written
	* @return Success in writing file; failure in writing file
	*/
	int save(vector<string>& data); //reads vector, writes to text file
};

#endif
